package cn.thr.ymcc.client;

import cn.thr.ymcc.CourseDoc;
import cn.thr.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;

import java.util.List;

public class SearchClientFallbackFactory implements FallbackFactory<SearchClient> {
    @Override
    public SearchClient create(Throwable throwable) {
        return new SearchClient() {
            @Override
            public JsonResult saveBatch(List<CourseDoc> courseDocs) {
                throwable.printStackTrace();
                return JsonResult.error("全文检索 saveBatch 接口调用失败"+ throwable.getMessage());
            }

            @Override
            public JsonResult deleteBatch(List<Long> courseId) {
                throwable.printStackTrace();
                return JsonResult.error("全文检索 deleteBatch 接口调用失败"+ throwable.getMessage());
            }
        };
    }
}
